/*
 * Copyright 2012-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.autoconfigure.amqp;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer;
import org.springframework.retry.support.RetryTemplate;

/**
 * 回调接口，用于自定义作为 Rabbit 基础设施一部分使用的 {@link RetryTemplate}。
 *
 * @author Stephane Nicoll
 * @since 2.1.0
 */
@FunctionalInterface
public interface RabbitRetryTemplateCustomizer {

	/**
	 * 回调方法，用于自定义在指定 {@link Target} 上下文中使用的 {@link RetryTemplate} 实例。
	 * @param target RetryTemplate 的 {@link Target} 目标
	 * @param retryTemplate 需要自定义的重试模板
	 */
	void customize(Target target, RetryTemplate retryTemplate);

	/**
	 * 定义 {@link RetryTemplate} 的可用目标。
	 */
	enum Target {

		/**
		 * {@link RabbitTemplate} 目标。
		 */
		SENDER,

		/**
		 * {@link AbstractMessageListenerContainer} 目标。
		 */
		LISTENER

	}

}

